<template>
	<view class="classifyLayout pageBg">
		<!-- 兼容：抖音小程序需要一定的条件才允许自定义头部 -->
		#<!-- #ifndef MP-TOUTIAO -->
		<custom-nav-bar title="分类"></custom-nav-bar>
		<!-- #endif -->
		<view class="classify">
			<theme-item v-for="item in classifyList" :key="item._id" :item="item"></theme-item>
		</view>
	</view>
</template>

<script setup>
import { ref } from 'vue'
import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
import { apiGetClassify } from '@/api/apis.js'

const classifyList = ref([])

const getClassify = async () => {
	const res = await apiGetClassify({
		pageSize: 15
	})
	// console.log(res)
	classifyList.value = res.data
}

// 分享给好友
onShareAppMessage((e) => {
	// console.log(e)
	return {
		title: '咸虾米壁纸', // 标题
		path: 'pages/classify/classify' // 点击分享到哪个页面
	}
})

// 分享到朋友圈
onShareTimeline(() => {
	return {
		title: '咸虾米壁纸', // 标题
		// imageUrl: '/static/images/logo2.jpg' // 分享的链接的图片
	}
})

getClassify()
</script>

<style lang="scss" scoped>
.classify {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 15rpx;
	padding: 30rpx;
}
</style>
